package org.swimv2.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the lavoro database table.
 * 
 */
@NamedQueries({
@NamedQuery(name="Lavoro.findByID",query="SELECT l FROM Lavoro l WHERE l.id=:id"),
@NamedQuery(name="Lavoro.findByUtentePartecipante", query="SELECT l FROM Lavoro l, Persona p WHERE p MEMBER OF l.personas AND p.userID=:userId"),
@NamedQuery(name="Lavoro.findByUtenteCommissionante", query="SELECT l FROM Lavoro l WHERE l.persona.userID=:userId")
})
@Entity
public class Lavoro implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id",nullable=false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	private String nome;

	private String sede;

	private String stato;

	//bi-directional many-to-one association to Feedback
	@OneToMany(mappedBy="lavoro")
	private List<Feedback> feedbacks;

	//bi-directional many-to-one association to Persona
	@ManyToOne
	@JoinColumn(name="userIDrichiedente")
	private Persona persona;

	//bi-directional many-to-many association to Abilita
	@ManyToMany(mappedBy="lavoros")
	private List<Abilita> abilitas;

	//bi-directional many-to-many association to Persona
	@ManyToMany(mappedBy="lavoros2")
	private List<Persona> personas;

	//bi-directional many-to-one association to Richiestapartecipazionelavoro
	@OneToMany(mappedBy="lavoro")
	private List<Richiestapartecipazionelavoro> richiestapartecipazionelavoros;

	public Lavoro() {
	}

	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSede() {
		return this.sede;
	}

	public void setSede(String sede) {
		this.sede = sede;
	}

	public String getStato() {
		return this.stato;
	}

	public void setStato(String stato) {
		this.stato = stato;
	}

	public List<Feedback> getFeedbacks() {
		return this.feedbacks;
	}

	public void setFeedbacks(List<Feedback> feedbacks) {
		this.feedbacks = feedbacks;
	}

	public Persona getPersona() {
		return this.persona;
	}

	public void setPersona(Persona persona) {
		this.persona = persona;
	}

	public List<Abilita> getAbilitas() {
		return this.abilitas;
	}

	public void setAbilitas(List<Abilita> abilitas) {
		this.abilitas = abilitas;
	}

	public List<Persona> getPersonas() {
		return this.personas;
	}

	public void setPersonas(List<Persona> personas) {
		this.personas = personas;
	}

	public List<Richiestapartecipazionelavoro> getRichiestapartecipazionelavoros() {
		return this.richiestapartecipazionelavoros;
	}

	public void setRichiestapartecipazionelavoros(List<Richiestapartecipazionelavoro> richiestapartecipazionelavoros) {
		this.richiestapartecipazionelavoros = richiestapartecipazionelavoros;
	}

}